import request from '../utils/axios';

export function getGroupList(data) {
	return request({
		url: '/inspectionGroup/getInspectionGroupList',
		method: 'get',
	    params:data
	});
}
export function getUserList(data) {
	return request({
		url: '/inspectionGroup/getUserList',
		method: 'get',
	    params:data
	});
}
export function addOrUpdateGroup(data, forEdit) {
    let formData = new FormData();
	Object.keys(data).forEach(key=>{
		formData.append(key, data[key]);
	})
    if ( forEdit ) {
        return request({
            url: '/inspectionGroup/editInspectionGroup',
            method: 'put',
            data:formData
        });
    } else {
        return request({
            url: '/inspectionGroup/addInspectionGroup',
            method: 'post',
            data:formData
        });
    }
}

export function delGroup(data) {
	let formData = new FormData();
	Object.keys(data).forEach(key=>{
		formData.append(key, data[key]);
	})
	return request({
		url: '/inspectionGroup/delInspectionGroup',
		method: 'delete',
		data:formData
	});
}
